$(function () {
    if (businessName== 'null' || businessName== ''){
        toastr.error("还未登录,请先登录")
        return null
    }

    if (reason != '' && reason != 'null'){
        toastr.error(reason+",请修改酒店信息")
    }
    //酒店类型
    if (hotelType == 1){
        $('#jj').prop("checked",true);
    }else if(hotelType == 2){
        $('#gy').prop("checked",true);
    }else if(hotelType == 3){
        $('#sw').prop("checked",true);
    }else if(hotelType == 4){
        $('#ql').prop("checked",true);
    }

    //酒店房间类型
    var valu1=hotelRoomType.length;
    console.info("value1:"+valu1);
    //遍历动态赋值 JSON.parse()将字符串c还原成对象a。
    $.each(JSON.parse(hotelRoomType),function(index,value){
        var num=value;
        console.info("num:"+num);
        $("input[type='checkbox'][name='hotelRoomType'][value="+ num +"]").prop("checked",true);
    });

    //酒店品牌
    if (hotelBrand == 1){
        $("input[type='radio'][name='hotelBrand'][value ='1']").prop("checked",true);
    } if (hotelBrand == 2){
        $("input[type='radio'][name='hotelBrand'][value ='2']").prop("checked",true);
    } if (hotelBrand == 3){
        $("input[type='radio'][name='hotelBrand'][value ='3']").prop("checked",true);
    }

    //服务设施
    $.each(JSON.parse(serviceFacilities),function (index,value) {
        $("input[type='checkbox'][name='serviceFacilities'][value="+ value +"]").prop("checked",true);
    })

    //早餐
    if(breakfast==1){
        $("input[type='radio'][name='breakfast'][value ='1']").prop("checked",true);
    } if(breakfast==2){
        $("input[type='radio'][name='breakfast'][value ='2']").prop("checked",true);
    }

    $('#btn-edit').click(function () {
        var resultJson=$('form').serialize();
        console.info("btn-updateEdit:"+resultJson);
        $.ajax({
            url:ctx+"businessHigh/uploadFileEdit",
            type:"post",
            dataType : "json",
            /*async:false, //不是异步处理*/
            data:resultJson,
            success : function (data) {
                    console.info("酒店信息更改状态:"+data.msg)
                    // 返回列表页面
                    toastr.success(data.msg);

            },
            error : function (data) {
                toastr.error(data.msg);
        }
        });
    })
    $('#btn-picInfo').click(function () {
        window.location.href=ctx+"business/uploadPhotoEdit"
    })
})